<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML3.2 EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="DOCTEXT">
<TITLE>mpif77</TITLE>
</HEAD>
<BODY BGCOLOR="FFFFFF">
<A NAME="mpif77"><H1>mpif77</H1></A>
Compiles and links MPI programs written in Fortran 77 
<H2>Description</H2>
This command can be used to compile and link MPI programs written in
Fortran.  It provides the options and any special libraries that are
needed to compile and link MPI programs.
<P>
It is important to use this command, particularly when linking programs,
as it provides the necessary libraries.
<P>
<H2>Command line arguments</H2>
<DL>
<DT><B>-show      </B><DD>Show the commands that would be used without
runnning them

<DT><B>-help      </B><DD>Give short help

<DT><B>-f77=name   </B><DD>Use compiler <TT>name</TT> instead of the default choice.  Use
this only if the compiler is compatible with the MPICH
library (see below)

<DT><B>-config=name </B><DD>Load a configuration file for a particular compiler.
This allows a single <TT>mpif77</TT> command to be used with 
multiple compilers.

<DT><B>-compile_info </B><DD>Show the steps for compiling a program.  This option
can be used to see what options and include paths are
used by mpif77.

<DT><B>-link_info </B><DD>Show the steps for linking a program.  This optoin 
can be used to see what options and libraries are used by
mpif77.

<DT><B>-profile=name </B><DD>Use the MPI profiling given by name.  See below for
details

<DT><B>-mpe=name  </B><DD>Use an MPE profiling library.  The behavior is similar
to using <TT>-profile=mpe_name.conf</TT>.

<DT><B>-echo      </B><DD>Show exactly what this program is doing.
This option should normally not be used.

<DT><B>others     </B><DD>are passed to the compiler or linker.  For example, <TT>-c
</TT>causes files to be compiled, <TT>-g</TT> selects compilation with
debugging on most systems, and <TT>-o name</TT> causes linking 
with the output executable given the name <TT>name</TT>.
</DL>
<P>
<H2>Environment Variables</H2>
The environment variables <TT>MPICH_F77</TT> may be used
to select different Fortran compiler and linker.  Note that since
MPICH is built with a particular C and Fortran compiler, change the
compilers used can cause problems.  Use this only if you could intermix
code compiled with the different compilers.
<P>
<H2>Compatible Compilers</H2>
The MPI library may be used with any compiler that uses the same
lengths for basic data objects (such as <TT>long double</TT>) and that
uses compatible run-time libraries.  On many systems, the various
compilers are compatible and may be used interchangably.  There are
exceptions; if you use the <TT>MPICH_F77</TT> environment variable or the
<TT>-f77=name</TT> command-line argument to override the choice of compiler
and encounter problems, try reconfiguring MPICH2 with the new compiler
and installing MPICH2 in a separate location.  See the installation manual
for more details.
<P>
<H2>Examples</H2>
To compile a single file <TT>foo.f</TT>, use
<PRE>
   mpif77 -c foo.f 
</PRE>

<P>
To link the output and make an executable, use
<PRE>
   mpif77 -o foo foo.o
</PRE>

Combining compilation and linking in a single command
<PRE>
   mpif77 -o foo foo.f
</PRE>

is a convenient way to build simple programs.
<P>
<H2>Selecting a Profiling Library</H2>
The <TT>-profile=name</TT> argument allows you to specify an MPI profiling
library to be used.  <TT>name</TT> can have two forms:
<P>
<BR>A library in the same directory as the MPI library
<BR>The name of a profile configuration file
<BR>
<P>
If <TT>name</TT> is a library, then this library is included before the MPI
library.  This allows the simple use of libraries that make use of the
MPI profiling interface and that are installed in the same directory as
the MPI library.
<P>
If <TT>name.conf</TT> is the name of a file in the sysconfdir directory, then this
is read and may define the following variables:
<DL>
<DT><B>PROFILE_PRELIB </B><DD>Libraries (and paths) to include before the MPI library

<DT><B>PROFILE_POSTLIB </B><DD>Libraries to include after the MPI library

<DT><B>PROFILE_INCPATHS </B><DD>C preprocessor arguments for any include files
For example, to add <TT>/usr/local/myprof/include</TT> to the include path and
the library <TT>libmyprof.a</TT> in <TT>/usr/local/myprof/lib</TT> to the link step, 
you could create the file <TT>myprof.conf</TT> with the lines
</DL>
<P>
<PRE>
    PROFILE_PRELIB="-L/usr/local/myprof/lib -lmyprof"
    PROFILE_INCPATHS="-I/usr/local/myprof/include"
</PRE>

and place it in the sysconfdir directory (this directory is set at
configure time when MPICH is built).  Then using the command-line
argument <TT>-profile=myprof</TT> will cause these
definitions to be added to the relevant compile commands.
<P>
<H2>See Also</H2>
 mpicc, mpicxx, mpif90, mpiexec
<BR><P><B>Location:</B>mpif77.txt<P>
</BODY></HTML>
